package com.dunke.web.controller;

import com.dunke.core.common.Result;
import com.dunke.core.data.model.ModelData;
import com.dunke.core.data.staff.StaffInfo;
import com.dunke.core.dto.ModelDto;
import com.dunke.service.ModelService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * (DbModel)表控制层
 * 产品分类
 * @author makejava
 * @since 2021-06-23 18:41:04
 */
@RestController
@RequestMapping("/model")
public class ModelController {
    /**
     * 服务对象
     */
    @Resource
    private ModelService modelService;

    /**
     * 新增员工
     * @param data 实例对象
     * @return 是否成功
     */
    @RequestMapping(path="/add", method=RequestMethod.PUT)
    public Result add(@Validated @RequestBody ModelData data) {
        return this.modelService.insert(data);
    }

    /**
     * 通过主键查询单条数据
     * @param data 实例对象
     * @return 单条数据
     */
    @GetMapping("select")
    public Result select(@Validated @RequestBody ModelData data) {
        return this.modelService.queryById(data);
    }

}
